package api

import (
	"github.com/gin-gonic/gin"
	"unlimited-comments/api/handler"
	"unlimited-comments/api/middleware"
)

func LoadRouter(router *gin.Engine) {

	api := router.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("register", handler.RegisterUser)
			user.POST("login", handler.LoginUser)
		}

		auth := api.Group("/auth")
		{
			auth.Use(middleware.Auth())
			auth.POST("addComment", handler.AddComment)
			auth.POST("addLike", handler.AddLike)
			auth.POST("deleteComment", handler.DeleteComment)
			auth.POST("addSubComment", handler.AddSubComment)
			auth.POST("deleteSubComment", handler.DeleteSubComment)
			auth.POST("goOut", handler.GoOutUser)
		}

		comment := api.Group("/comment ")
		{
			comment.GET("list", handler.ListComment)
			comment.GET("listByAuthor", handler.ListByAuthorComment)

		}
	}

}
